<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script>
	function chkForm(){
		//用户名不为空验证
		var txt=document.getElementById("userName");
		var msg=document.getElementById("nameMsg");
		if(txt.value.length==0){
			msg.style.display="";
			txt.focus();
			return false;
		}else{
			msg.style.display="none";
		}
		
		//密码不为空验证
		txt=document.getElementById("pwd1");
		msg=document.getElementById("pwd1Msg");
		if(txt.value.length==0){
			msg.style.display="";
			txt.focus();
			return false;
		}else{
			msg.style.display="none";
		}
		
		//密码一致验证
		var pwd2=document.getElementById("pwd2").value;
		var msg2=document.getElementById("pwd2Msg");
		//密码不相等
		if(txt.value!=pwd2){
			msg2.style.display="";
			txt.focus();
			return false;
		}else{
			msg2.style.display="none";
		}
		
		
		//邮箱格式验证
		txt=document.getElementById("mail");
		msg=document.getElementById("mailMsg");
		var regex=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
		if(regex.test(txt.value)==false){
			msg.style.display="";
			txt.focus();
			return false;
		}else{
			msg.style.display="none";
		}
		return true;
	}
</script>
</head>
<body>
<div id="header" class="wrap">
	<div id="logo">北大青鸟网上书城</div>
	<div id="navbar">
		<form method="get" name="search" action="">
			搜索：<input class="input-text" type="text" name="keywords" /><input class="input-btn" type="submit" name="submit" value="" />
		</form>
	</div>
</div>
<div id="register">
	<div class="title">
		<h2>欢迎注册北大青鸟网上书城</h2>
	</div>
	<div class="steps">
		<ul class="clearfix">
			<li class="current">1.填写注册信息</li>
			<li class="unpass">2.注册成功</li>
		</ul>
	</div>
	<form method="post" action="user.do?opt=register"
		 onsubmit="return chkForm();">
		<dl>
			<dt>用 户 名：</dt>
			<dd><input class="input-text" type="text" 
				id="userName" name="userName" />
				<span id="nameMsg" style="display:none">用户不能为空！</span></dd>
			<dt>密　　码：</dt>
			<dd><input class="input-text" type="password" id="pwd1" name="passWord" />
			<span id="pwd1Msg" style="display:none">密码不能为空！</span></dd>
			<dt>确认密码：</dt>
			<dd><input class="input-text" type="password" id="pwd2" name="rePassWord" />
			<span id="pwd2Msg" style="display:none">两次密码输入不一致！</span></dd>
			<dt>Email地址：</dt>
			<dd><input class="input-text" type="text" id="mail" name="email" />
			<span id="mailMsg" style="display:none">邮箱输入不正确！</span></dd>
			<dt></dt>
			<dd class="button"><input class="input-reg" type="submit" name="register" value="" /></dd>
		</dl>
	</form>
</div>
<div id="footer" class="wrap">
	北大青鸟网上书城 &copy; 版权所有

</div>
</body>
</html>
